home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libcruft / lapack / zlaswp.f < prev    next >
Text File  |  1996-07-19  |  3KB  |  99 lines

  1.       SUBROUTINE ZLASWP( N, A, LDA, K1, K2, IPIV, INCX )
  2. *
  3. *  -- LAPACK auxiliary routine (version 2.0) --
  4. *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5. *     Courant Institute, Argonne National Lab, and Rice University
  6. *     October 31, 1992
  7. *
  8. *     .. Scalar Arguments ..
  9.       INTEGER            INCX, K1, K2, LDA, N
  10. *     ..
  11. *     .. Array Arguments ..
  12.       INTEGER            IPIV( * )
  13.       COMPLEX*16         A( LDA, * )
  14. *     ..
  15. *
  16. *  Purpose
  17. *  =======
  18. *
  19. *  ZLASWP performs a series of row interchanges on the matrix A.
  20. *  One row interchange is initiated for each of rows K1 through K2 of A.
  21. *
  22. *  Arguments
  23. *  =========
  24. *
  25. *  N       (input) INTEGER
  26. *          The number of columns of the matrix A.
  27. *
  28. *  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
  29. *          On entry, the matrix of column dimension N to which the row
  30. *          interchanges will be applied.
  31. *          On exit, the permuted matrix.
  32. *
  33. *  LDA     (input) INTEGER
  34. *          The leading dimension of the array A.
  35. *
  36. *  K1      (input) INTEGER
  37. *          The first element of IPIV for which a row interchange will
  38. *          be done.
  39. *
  40. *  K2      (input) INTEGER
  41. *          The last element of IPIV for which a row interchange will
  42. *          be done.
  43. *
  44. *  IPIV    (input) INTEGER array, dimension (M*abs(INCX))
  45. *          The vector of pivot indices.  Only the elements in positions
  46. *          K1 through K2 of IPIV are accessed.
  47. *          IPIV(K) = L implies rows K and L are to be interchanged.
  48. *
  49. *  INCX    (input) INTEGER
  50. *          The increment between successive values of IPIV.  If IPIV
  51. *          is negative, the pivots are applied in reverse order.
  52. *
  53. * =====================================================================
  54. *
  55. *     .. Local Scalars ..
  56.       INTEGER            I, IP, IX
  57. *     ..
  58. *     .. External Subroutines ..
  59.       EXTERNAL           ZSWAP
  60. *     ..
  61. *     .. Executable Statements ..
  62. *
  63. *     Interchange row I with row IPIV(I) for each of rows K1 through K2.
  64. *
  65.       IF( INCX.EQ.0 )
  66.      $   RETURN
  67.       IF( INCX.GT.0 ) THEN
  68.          IX = K1
  69.       ELSE
  70.          IX = 1 + ( 1-K2 )*INCX
  71.       END IF
  72.       IF( INCX.EQ.1 ) THEN
  73.          DO 10 I = K1, K2
  74.             IP = IPIV( I )
  75.             IF( IP.NE.I )
  76.      $         CALL ZSWAP( N, A( I, 1 ), LDA, A( IP, 1 ), LDA )
  77.    10    CONTINUE
  78.       ELSE IF( INCX.GT.1 ) THEN
  79.          DO 20 I = K1, K2
  80.             IP = IPIV( IX )
  81.             IF( IP.NE.I )
  82.      $         CALL ZSWAP( N, A( I, 1 ), LDA, A( IP, 1 ), LDA )
  83.             IX = IX + INCX
  84.    20    CONTINUE
  85.       ELSE IF( INCX.LT.0 ) THEN
  86.          DO 30 I = K2, K1, -1
  87.             IP = IPIV( IX )
  88.             IF( IP.NE.I )
  89.      $         CALL ZSWAP( N, A( I, 1 ), LDA, A( IP, 1 ), LDA )
  90.             IX = IX + INCX
  91.    30    CONTINUE
  92.       END IF
  93. *
  94.       RETURN
  95. *
  96. *     End of ZLASWP
  97. *
  98.       END
  99.